Add Multi-segment LCD component.#3621
Conversation
There was a problem hiding this comment.
If this file is not used, it should not be part of the PR
There was a problem hiding this comment.
The unused stuff is used as reference for making the new editor.
| self.Mode = mode | ||
| end | ||
|
|
||
| function Transform(self,x,y) |
There was a problem hiding this comment.
This should be a local function. Using function without local will make it a global and pollute the global table. This increases the risks of addon conflicts. Please sure you check all functions to not be global. All functions should be local until they have a good reason not to be.
This advice does not apply to function stuff:method() as these functions (methods) stay in the scope of stuff in context of the file Editor.
There was a problem hiding this comment.
That's fair. I forgot about that coming from other languages 😁
There was a problem hiding this comment.
I put these functions as local in the newest commit 645ea76
LoopToTris is used in the entity but also will be used in the editor for a triangulation preview.
| end | ||
|
|
||
| // | ||
| // Create basic fonts |
There was a problem hiding this comment.
Better stick with -- commits.
Edit: Changing commit style in gpulib might be out of scope for your PR though.
| end | ||
| --[[ | ||
| function TOOL.BuildCPanel(panel) | ||
| WireDermaExts.ModelSelect(panel, "wire_multisegmentlcd_model", list.Get( "WireScreenModels" ), 5) |
There was a problem hiding this comment.
Seems to be a large unused part of the code, you might want to remove, refactor or repurpose.
There was a problem hiding this comment.
Thats the old editor. I'll remove it once the new editor is done.
| for i = 1,4 do | ||
| if iname == "Memory"..i then | ||
| self.Memory[i] = self.Inputs["Memory"..i].Src | ||
| self.Memory[i] = self.Inputs["Memory"..i].Src and self.Inputs["Memory"..i].Src:GetTable() or nil |
There was a problem hiding this comment.
Question to other wire developers: Does it have any unintended side effect? This used to be an Entity, now it is an Entity:GetTable().
| function ENT:SendSerializedTree(ply) | ||
| if self.Tree == nil then return end | ||
| local serialized = WireLib.von.serialize(self.Tree) | ||
| if #serialized > 65535 then |
There was a problem hiding this comment.
The real limit of net messages is less then 65535, especially if you add other data such as color and resolution. I would recommend to limit it to like 60000 to have a large enough margin for everything combined.
| } | ||
| end | ||
|
|
||
| function ENT:TransformOffset(x,y) |
There was a problem hiding this comment.
This looks like duplicate code. (see: https://github.com/wiremod/wire/pull/3621/changes#diff-9b6da116555147f580bc459531de15346269b3499bc2df686ff3f4805752f3d0R78) You might want to build a sub library for your project to reduce duplicated logic.
There was a problem hiding this comment.
I'll have to replace the while transformation logic cause it's a mess.
Adds a customizable segmented "LCD" along with a graphical editor to create layouts.
